home *** CD-ROM | disk | FTP | other *** search
/ Delphi Programmer's Power Pack / Delphi Volume 1.iso / s_to_z / timagefx / imgfxfrm.pas < prev    next >
Pascal/Delphi Source File  |  1996-09-15  |  5KB  |  209 lines

  1. unit ImgFXfrm;
  2.  
  3. interface
  4.  
  5. uses
  6.     SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.     Forms, Dialogs, ExtCtrls, Gfvcl, ImageFX, TStretch, StdCtrls,
  8.     Buttons;
  9.  
  10. type
  11.   TForm1 = class(TForm)
  12.     Panel1: TPanel;
  13.         Panel3: TPanel;
  14.         BitBtn2: TBitBtn;
  15.     Panel2: TStretchPanel;
  16.     BitBtn1: TBitBtn;
  17.     Label1: TLabel;
  18.     Label2: TLabel;
  19.     DelayScroller: TScrollBar;
  20.     RateScroller: TScrollBar;
  21.     Label3: TLabel;
  22.     Label4: TLabel;
  23.     GradientFill1: TGradientFill;
  24.     ImageFX1: TImageFX;
  25.         procedure FormResize(Sender: TObject);
  26.         procedure BitBtn1Click(Sender: TObject);
  27.     procedure DelayScrollerChange(Sender: TObject);
  28.     procedure RateScrollerChange(Sender: TObject);
  29.     private
  30.         procedure WaitForEffect;
  31.     public
  32.         { Public declarations }
  33.     end;
  34.  
  35. var
  36.     Form1: TForm1;
  37.  
  38. implementation
  39.  
  40. uses AbtImgFX;
  41.  
  42. {$R *.DFM}
  43.  
  44. procedure TForm1.FormResize(Sender: TObject);
  45. const EffectType: string = ' Effect: ';
  46. begin
  47.     if ImageFX1.Drawing then        {Run-time read only property to indicate when an effect is being processed}
  48.         exit;    {Don't allow the stack to get overrun...creates a nasty GPF!}
  49.  
  50.     ImageFX1.EffectDelay := DelayScroller.Position;
  51.     ImageFX1.EffectRate := RateScroller.Position;
  52.  
  53.     Label3.Caption := IntToStr(DelayScroller.Position);
  54.     Label4.Caption := IntToStr(RateScroller.Position);
  55.  
  56.     ImageFX1.LoadFromFile('earth.bmp');
  57.     ImageFX1.Effect := ViewExplode;
  58.     Panel3.Caption := EffectType + 'ViewExplode';
  59.     ImageFX1.Show;
  60.     WaitForEffect;
  61.  
  62.     ImageFX1.Effect := ViewZoomIn;
  63.     Panel3.Caption := EffectType + 'ViewZoomIn';
  64.     ImageFX1.Show;
  65.     WaitForEffect;
  66.  
  67.     ImageFX1.Effect := ViewZoomOut;
  68.     Panel3.Caption := EffectType + 'ViewZoomOut';
  69.     ImageFX1.Show;
  70.     WaitForEffect;
  71.  
  72.     ImageFX1.LoadFromFile('skyline.bmp');
  73.     ImageFX1.Effect := HideImplode;
  74.     Panel3.Caption := EffectType + 'HideImplode';
  75.     ImageFX1.Show;
  76.     WaitForEffect;
  77.  
  78.     ImageFX1.Effect := HideZoomIn;
  79.     Panel3.Caption := EffectType + 'HideZoomIn';
  80.     ImageFX1.Show;
  81.     WaitForEffect;
  82.  
  83.     ImageFX1.Effect := HideZoomOut;
  84.     Panel3.Caption := EffectType + 'HideZoomOut';
  85.     ImageFX1.Show;
  86.     WaitForEffect;
  87.  
  88.     ImageFX1.LoadFromFile('earth.bmp');
  89.     ImageFX1.Effect := WipeRightRoll;
  90.     Panel3.Caption := EffectType + 'WipeRightRoll';
  91.     ImageFX1.Show;
  92.     WaitForEffect;
  93.  
  94.     ImageFX1.Effect := WipeRightSlide;
  95.     Panel3.Caption := EffectType + 'WipeRightSlide';
  96.     ImageFX1.Show;
  97.     WaitForEffect;
  98.  
  99.     ImageFX1.Effect := WipeRightStretch;
  100.     Panel3.Caption := EffectType + 'WipeRightStretch';
  101.     ImageFX1.Show;
  102.     WaitForEffect;
  103.  
  104.     ImageFX1.LoadFromFile('skyline.bmp');
  105.     ImageFX1.Effect := WipeLeftRoll;
  106.     Panel3.Caption := EffectType + 'WipeLeftRoll';
  107.     ImageFX1.Show;
  108.     WaitForEffect;
  109.  
  110.     ImageFX1.Effect := WipeLeftSlide;
  111.     Panel3.Caption := EffectType + 'WipeLeftSlide';
  112.     ImageFX1.Show;
  113.     WaitForEffect;
  114.  
  115.     ImageFX1.Effect := WipeLeftStretch;
  116.     Panel3.Caption := EffectType + 'WipeLeftStretch';
  117.     ImageFX1.Show;
  118.     WaitForEffect;
  119.  
  120.     ImageFX1.LoadFromFile('earth.bmp');
  121.     ImageFX1.Effect := WipeUpRoll;
  122.     Panel3.Caption := EffectType + 'WipeUpRoll';
  123.     ImageFX1.Show;
  124.     WaitForEffect;
  125.  
  126.     ImageFX1.Effect := WipeUpSlide;
  127.     Panel3.Caption := EffectType + 'WipeUpSlide';
  128.     ImageFX1.Show;
  129.     WaitForEffect;
  130.  
  131.     ImageFX1.Effect := WipeUpStretch;
  132.     Panel3.Caption := EffectType + 'WipeUpStretch';
  133.     ImageFX1.Show;
  134.     WaitForEffect;
  135.  
  136.     ImageFX1.LoadFromFile('skyline.bmp');
  137.     ImageFX1.Effect := WipeDownRoll;
  138.     Panel3.Caption := EffectType + 'WipeDownRoll';
  139.     ImageFX1.Show;
  140.     WaitForEffect;
  141.  
  142.     ImageFX1.Effect := WipeDownSlide;
  143.     Panel3.Caption := EffectType + 'WipeDownSlide';
  144.     ImageFX1.Show;
  145.     WaitForEffect;
  146.  
  147.     ImageFX1.Effect := WipeDownStretch;
  148.     Panel3.Caption := EffectType + 'WipeDownStretch';
  149.     ImageFX1.Show;
  150.     WaitForEffect;
  151.  
  152.     ImageFX1.LoadFromFile('earth.bmp');
  153.     ImageFX1.Effect := SideCurtainRoll;
  154.     Panel3.Caption := EffectType + 'SideCurtainRoll';
  155.     ImageFX1.Show;
  156.     WaitForEffect;
  157.  
  158.     ImageFX1.LoadFromFile('skyline.bmp');
  159.     ImageFX1.Effect := VertCurtainRoll;
  160.     Panel3.Caption := EffectType + 'VertCurtainRoll';
  161.     ImageFX1.Show;
  162.     WaitForEffect;
  163.  
  164.     ImageFX1.Effect := HideZoomOut;
  165.     Panel3.Caption := EffectType + 'HideZoomOut';
  166.     ImageFX1.Show;
  167.     WaitForEffect;
  168.  
  169.     ImageFX1.LoadFromFile('skyline.bmp');        {This simply displays the bitmap}
  170.     ImageFX1.Effect := None;
  171.     Panel3.Caption := EffectType + 'None';
  172.     ImageFX1.Show;
  173.     WaitForEffect;
  174. end;
  175.  
  176. {A loop to allow current wipe to finish and change effect rate and delay during draw}
  177. procedure TForm1.WaitForEffect;
  178. begin
  179.     BitBtn1.Enabled := False;
  180.     while ImageFX1.Drawing do
  181.     begin
  182.         Application.ProcessMessages;
  183.         ImageFX1.EffectDelay := DelayScroller.Position;
  184.         ImageFX1.EffectRate := RateScroller.Position;
  185.  
  186.         Label3.Caption := IntToStr(DelayScroller.Position);
  187.         Label4.Caption := IntToStr(RateScroller.Position);
  188.     end;
  189.     BitBtn1.Enabled := True;
  190. end;
  191.  
  192. procedure TForm1.BitBtn1Click(Sender: TObject);
  193. begin
  194.     AboutBox.Show;
  195. end;
  196.  
  197. procedure TForm1.DelayScrollerChange(Sender: TObject);
  198. begin
  199.     Label3.Caption := IntToStr(DelayScroller.Position);
  200. end;
  201.  
  202. procedure TForm1.RateScrollerChange(Sender: TObject);
  203. begin
  204.     Label4.Caption := IntToStr(RateScroller.Position);
  205. end;
  206.  
  207. initialization
  208. end.
  209.